package com.smrs.goods.webapp.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Hibernate;

import com.jof.framework.util.Pager;
import com.smrs.basicdata.webapp.action.KeyValueModel;
import com.smrs.enums.StatusEnum;
import com.smrs.goods.enums.CategoryLevelEnum;
import com.smrs.goods.model.GoodsAttributeModel;
import com.smrs.goods.model.GoodsCategoryModel;
import com.smrs.security.model.UserModel;
import com.smrs.util.AppUtil;
import com.smrs.util.DictConstants;



public class SearchCategoryAction extends BaseGoodsAction{
	
	private static final long serialVersionUID = 1L;
	protected final String rootCategory="根类目";
	protected GoodsCategoryModel goodsCategory = new GoodsCategoryModel();
	//protected 
	protected List<GoodsCategoryModel> allGoodsCategoryList = new ArrayList<GoodsCategoryModel>();
	
	
	protected List<GoodsAttributeModel> allGoodsAttributeList = new  ArrayList<GoodsAttributeModel>();
	protected List<GoodsAttributeModel> selectedGoodsAttributeList = new  ArrayList<GoodsAttributeModel>();
	protected List<GoodsAttributeModel> heritageGoodsAttributeList  =new  ArrayList<GoodsAttributeModel>();
	protected List<GoodsAttributeModel> availableGoodsAttributeList = new ArrayList<GoodsAttributeModel>();

	protected Pager<GoodsCategoryModel> pager = new Pager<GoodsCategoryModel>(); 
	protected String titleName="类目";
	protected Long parentId;
	protected Long queryLevel;
	protected String parentCategoryId;
	
	protected String []selectedAttribute;
	
	protected Long nodeid;


	public Long getNodeid() {
		return nodeid;
	}

	public void setNodeid(Long nodeid) {
		this.nodeid = nodeid;
	}

	public List<GoodsAttributeModel> getHeritageGoodsAttributeList() {
		return heritageGoodsAttributeList;
	}

	public List<GoodsAttributeModel> getAvailableGoodsAttributeList() {
		return availableGoodsAttributeList;
	}

	public String getParentCategoryId() {
		return parentCategoryId;
	}

	public void setParentCategoryId(String parentCategoryId) {
		this.parentCategoryId = parentCategoryId;
	}



	public Long getQueryLevel() {
		return queryLevel;
	}

	public void setQueryLevel(Long queryLevel) {
		this.queryLevel = queryLevel;
	}

	public String[] getSelectedAttribute() {
		return selectedAttribute;
	}

	public void setSelectedAttribute(String[] selectedAttribute) {
		this.selectedAttribute = selectedAttribute;
	}

	
	
	
	
	


	
	
	public String searchCategory(){
		//allGoodsCategoryList=goodsCategoryService.getAllActive();
		if(nodeid!=null){
			pager=goodsCategoryService.getSubCategory(pager,nodeid);
		}else{
			pager = goodsCategoryService.getFirstLevel(pager);
		}
		
		return SUCCESS;
	}

	
	
	

	


	public Pager<GoodsCategoryModel> getPager() {
		return pager;
	}


	public void setPager(Pager<GoodsCategoryModel> pager) {
		this.pager = pager;
	}

	public String getTitleName() {
		return titleName;
	}


	public void setTitleName(String titleName) {
		this.titleName = titleName;
	}

	public List<GoodsCategoryModel> getAllGoodsCategoryList() {
		return allGoodsCategoryList;
	}


	public void setAllGoodsCategoryList(List<GoodsCategoryModel> allGoodsCategoryList) {
		this.allGoodsCategoryList = allGoodsCategoryList;
	}


	public GoodsCategoryModel getGoodsCategory() {
		return goodsCategory;
	}


	public void setGoodsCategory(GoodsCategoryModel goodsCategory) {
		this.goodsCategory = goodsCategory;
	}
	
	public List<GoodsAttributeModel> getAllGoodsAttributeList() {
		return allGoodsAttributeList;
	}


	public void setAllGoodsAttributeList(
			List<GoodsAttributeModel> allGoodsAttributeList) {
		this.allGoodsAttributeList = allGoodsAttributeList;
	}
	
	
	public List<GoodsAttributeModel> getSelectedGoodsAttributeList() {
		return selectedGoodsAttributeList;
	}


	public void setSelectedGoodsAttributeList(
			List<GoodsAttributeModel> selectedGoodsAttributeList) {
		this.selectedGoodsAttributeList = selectedGoodsAttributeList;
	}
	public Long getParentId() {
		return parentId;
	}


	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}
}
